package tedu.study.day05;

import java.util.Scanner;

public class Day05Practise {
    public static void main(String[] args) {
        //扫描仪
        Scanner scan = new Scanner(System.in);
        //addition(scan);
        multiTable();
    }

    // Addition随机加法运算器
    public static void addition(Scanner scan){
        int score = 0;
        for(int i=1;i<=10;i++){
            int a = (int)(Math.random()*100);
            int b = (int)(Math.random()*100);
            int result = a+b;//保存结果
            System.out.println("("+i+")"+a+"+"+b+"=?");
            System.out.println("请答题！");
            int answer = scan.nextInt();
            //判题
            if(answer == result){
                System.out.println("答对了！");
                score+=10;
            }else{
                System.out.println("答错了！");
            }
        }
        System.out.println("总成绩为："+score);

    }

    public static void multiTable(){
        for(int i=1;i<=9;i++){
            for(int j=1;j<=i;j++){
                System.out.print(i+"*"+j+"="+i*j+"\t");
            }
            System.out.println();
        }
    }

    public static void arrayFor(){
        int[] arr = new int[10];

        int[] arr1 = new int[3];
        int[] arr2 = {3,9,8};
        int[] arr3 = new int[]{3,9,8};

        System.out.println("数组长度"+arr.length);
        System.out.println("数组第一个元素"+arr[0]);

        for(int i=0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*100);
            System.out.println(arr[i]);
        }
    }
}
